package com.bcx.crm.plat.util;

import com.google.gson.Gson;

public class GsonUtil {
    public static void main(String[] args) {
        User user = new User("张三",24,"邮箱");
        Gson gson = new Gson();
        String s = gson.toJson(user);
        System.out.println(s);
        User user1 = gson.fromJson(s, User.class);
        System.out.println(user1.toString());
    }
}
class User{
    private String name;
    private int age;
    private String emailAddress;

    public User(String name, int age, String emailAddress) {
        this.name = name;
        this.age = age;
        this.emailAddress = emailAddress;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getEmailAddress() {
        return emailAddress;
    }

    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

    @Override
    public String toString() {
        return super.toString();
    }
}